package com.acwing.chapter3;

import java.io.*;
import java.util.Arrays;

/**
 * @author anan
 * @create 2021-08-29 0:50
 */
public class HashLalianfa {
    private static int N = 100003;
    private static int[] h = new int[N];
    private static int[] e = new int[N];
    private static int[] ne = new int[N];
    private static int idx;

    private static void init(){
        Arrays.fill(h, -1);
    }

    private static void insert(int x){
        int k = (x%N + N) % N;
        e[idx] = x;
        ne[idx] = h[k];
        h[k] = idx++;
    }

    private static boolean query(int x){
        int k = (x % N + N) % N ;
        for (int i = h[k]; i != -1; i = ne[i]) {
            if (e[i] == x) return true;
        }
        return false;
    }

    public static void main(String[] args) throws IOException {
        init();
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] str1 = reader.readLine().split(" ");
        int n = Integer.parseInt(str1[0]);

        while (n-- > 0){
            String[] str2 = reader.readLine().split(" ");
            int x = Integer.parseInt(str2[1]);
            if ("I".equals(str2[0])) insert(x);
            else if("Q".equals(str2[0])){
                if (query(x)) writer.write("Yes" + " \n");
                else writer.write("No" + "\n");
            }
        }
        writer.flush();
        writer.close();
        reader.close();
    }


}
